import { defineConfig } from "vite";
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { resolve } from 'path'
import Markdown from 'vite-plugin-md'
import { viteMockServe } from 'vite-plugin-mock'
export default defineConfig({
    optimizeDeps: {
        include: []
    },
    envPrefix: "ENV_",
    css: {
        modules: {
            localsConvention: "camelCaseOnly",
            scopeBehaviour: "local",
            hashPrefix: 'ljh',
        },
        preprocessorOptions: {
            less: {},
            sass: {
                additionalData: `@import "@/style/varuavles.scss";`,
                javascriptEnabled: true
            }
        },
        devSourcemap: true
    },
    resolve: {
        alias: {
            '@': resolve(__dirname, './src')
        }
    },
    plugins: [
        vue({
            include: [/\.vue$/, /\.md$/],
        }),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
        Markdown(),
        viteMockServe({
            supportTs:false,
            logger: false,
            mockPath: "./mock/"
          })
    ],
    // server: {
    //     proxy: {
    //         '/api': {
    //             target: 'http://localhost:3000',
    //             changeOrigin: true,
    //             rewrite: (path) => path.replace(/^\/api/, '')  // 替换路径，去除
    //         }
    //     }
    // }
})
